-
-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include already-installed matching requirements in the to_install set, so that pip-sync reliably installs dependencies #907
Conversation
This comment has been minimized.
This comment has been minimized.
38ea006
to
18135b4
Compare
06443f4
to
d297618
Compare
a897729
to
79db79e
Compare
79db79e
to
ecb4e79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndydeCleyre could --no-deps
be implemented in a separate PR? It could be useful for this case, see #827 (comment).
ecb4e79
to
57be3cb
Compare
@atugushev sure: #987 But I will note again, this more complete pull request (#907) is required to achieve consistent and predictable behavior. Current behavior is to sometimes act like |
57be3cb
to
db53e27
Compare
db53e27
to
231d2f0
Compare
Before: $ echo "pytest==5.1.2" > requirements.txt
$ pip-sync /dev/null
$ pip-sync requirements.txt
$ pip freeze | wc -l
12
$ pip-sync requirements.txt
$ pip freeze | wc -l
4
$ pip-sync --pip-args --no-deps requirements.txt
$ pip freeze | wc -l
4
$ pip-sync /dev/null
$ pip-sync --pip-args --no-deps requirements.txt
$ pip freeze | wc -l
4 After: $ echo "pytest==5.1.2" > requirements.txt
$ pip-sync /dev/null
$ pip-sync requirements.txt
$ pip freeze | wc -l
12
$ pip-sync requirements.txt
$ pip freeze | wc -l
12
$ pip-sync --pip-args --no-deps requirements.txt
$ pip freeze | wc -l
4
$ pip-sync /dev/null
$ pip-sync --pip-args --no-deps requirements.txt
$ pip freeze | wc -l
4 |
231d2f0
to
fae0ba7
Compare
fae0ba7
to
d4aff32
Compare
d4aff32
to
7e7f527
Compare
7f92b36
to
102f574
Compare
102f574
to
5574fdc
Compare
@AndydeCleyre @atugushev are you still interested in getting this ready for merging? It is a very old PR. At least the PR title and descriptions needs a little bit of simplification. |
ccde1e7
to
797a858
Compare
2a70c28
to
34d68de
Compare
34d68de
to
4a71abf
Compare
0897c9b
to
769ba1d
Compare
1b4c00a
to
08a007a
Compare
08a007a
to
116b43b
Compare
f90d583
to
ae91e12
Compare
Fixes jazzband#896 By including already-installed matching requirements in the to_install set, dependencies of pinned packages will be installed, after potentially being uninstalled, regardless of environment state at time of sync. The already-installed reqs will still not be reinstalled, thanks to pip's own handling. The resulting state is more consistent, predictable, and practical. Modify tests to expect explicit requirements in the to_install set, to match.
@atugushev I have the impression that @webknjaz took care of this one, does it look ok now? If so, lets merge it. |
As @AndydeCleyre said there's still no consensus on that. My point is described here. BTW with the current fix, Details
|
@ssbarnea I think I only rebased it |
Closed based on #896 (comment). |
Have
diff
include already-installed matching requirements in itsto_install
set.This means that during sync, dependencies of desired packages will be (re)installed after potentially being uninstalled, regardless of environment state at time of sync, for a more consistent, predictable, and practical resulting state. Fixes #896.
If this is not desired,
--no-deps
can be provided via the new--pip-args
option, whereby it will be passed through topip install
, and un-locked deps will be either removed or not installed, to match the lockfile exactly.The following existing tests check the
to_install
set, and are herein adjusted to expect the inclusion of explicit requirements (all intest_sync.py
):test_diff_should_do_nothing
test_diff_should_uninstall
test_diff_should_uninstall_with_markers
test_diff_leave_packaging_packages_alone
test_diff_leave_piptools_alone
test_diff_with_matching_url_versions
Note:
test_diff_with_matching_url_versions
, before this change, expects pip-tools to prevent reinstallation of versioned URL requirements, but this is unnecessary aspip
itself will do that, reporting "Requirement already satisfied . . .", and the test's comment is updated to reflect that. If this is incorrect under some circumstance, please correct me!Changelog-friendly one-liner:
pip-sync
now ensures installation of dependencies of a locked requirement, even if those deps are not locked and the locked requirement is already installed; this can be disabled withpip-sync --pip-args=--no-deps
.Contributor checklist
If this were to be accepted, would the appropriate merge point be the next major version, as the behavior may not be what is currently expected? I view it as a bug fix, and do not know when or why the current behavior would be desired instead, but I am only me.
@atugushev Please have a look for discussion and review. Thanks!